/**
 * Copyright (c) 2025 myons Inc. All rights reserved.
 */
package cn.zmwh.common.mybatis.page;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * @describe: 、
 * @author: dmzmwh 、
 * @time: 2025-03-16 9:56 、
 */
@Setter
@Getter
public class PageRequest<T> extends Page<T> {

    @ApiModelProperty(value = "用户ID 从token中取值前端忽略")
    private Long uid;
    @ApiModelProperty(value = "店铺Id，从token中取值前端忽略")
    private Long bsAccountId;
    @ApiModelProperty(value = "昵称，从token中取值前端忽略")
    private String nike;
    @ApiModelProperty(value = "手机号，从token中取值前端忽略")
    private String sub;

    @ApiModelProperty(value = "排序 格式(字段:[asc|desc];[asc|desc];) asc、desc不传默认asc 例如update_time:asc;id:desc")
    private String ordersStr;


//    @Override
//    public List<OrderItem> orders() {
//        List<OrderItem> orders = super.orders();
//        if (CollUtil.isNotEmpty(orders) || StrUtil.isBlank(ordersStr)){
//            return orders;
//        }
//        String[] split = ordersStr.split(";");
//        for (String fieldsItem : split) {
//            if (StrUtil.isBlank(fieldsItem)){
//                continue;
//            }
//            String[] itemSplit = fieldsItem.split(":");
//            String asc = itemSplit.length > 1 ? itemSplit[1] : "asc";
//            OrderItem orderItem = new OrderItem();
//            orderItem.setColumn(itemSplit[0]);
//            orderItem.setAsc(asc.equals("asc"));
//            orders.add(orderItem);
//        }
//        return orders;
//    }
}
